package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
	"house/config"
)

type Text struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func TextCensor(message string) bool {
	data := config.ConfigData.TextSafe
	client := censor.NewClient(data.Ak, data.Sk)

	res := client.TextCensor(message)
	fmt.Println(res)

	var resp Text
	_ = json.Unmarshal([]byte(res), &resp)
	if resp.ConclusionType == 1 {
		return true
	}
	return false

}
